package com.cq.hd.product.controller;

import com.cq.hd.common.response.Result;
import com.cq.hd.common.response.ResultGenerator;
import com.cq.hd.product.api.TbActiveShareApi;
import com.cq.hd.product.api.dto.ActiveShareStatisticsDto;
import com.cq.hd.product.api.vo.ActiveAgentShareCountVo;
import com.cq.hd.product.api.vo.ActiveShareRecordVo;
import com.cq.hd.product.api.vo.ActiveShareStatisticsVo;
import com.cq.hd.product.service.TbActiveShareService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 活动分享记录表 前端控制器
 * </p>
 *
 * @author mYunYu
 * @since 2023-11-23
 */
@RestController
public class TbActiveShareController implements TbActiveShareApi {

    @Autowired
    private TbActiveShareService activeShareService;

    @ApiOperation(value = "根据活动id查询活动折扣数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "code", value = "分享码", paramType = "query", dataType = "Long"),
            @ApiImplicitParam(name = "activeId", value = "活动id", paramType = "query", dataType = "Long")
    })
    @ApiResponse(response = ActiveShareRecordVo.class, code = 200, message = "接口返回对象参数")
    @Override
    public Result<ActiveShareRecordVo> getByCode(String code, Long activeId) {
        return ResultGenerator.success(activeShareService.getByCode(code, activeId));
    }

    @ApiOperation(value = "根据条件查询活动分享数据")
    @Override
    public Result<List<ActiveShareStatisticsVo>> listByDto(ActiveShareStatisticsDto activeShareStatisticsDto) {
        return ResultGenerator.success(activeShareService.listByDto(activeShareStatisticsDto));
    }

    @ApiOperation(value = "活动经纪人分享次数")
    @Override
    public Result<List<ActiveAgentShareCountVo>> getAgentShareCountByActiveIds(List<Long> activeIds) {
        return ResultGenerator.success(activeShareService.getAgentShareCountByActiveIds(activeIds));
    }
}
